<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>博客</title>
    <link rel="stylesheet" type="text/css" href="/public/css/main.css" />
    <script src="/public/js/jquery.min.js"></script>
    <script src="/public/js/index.js"></script>
</head>
<body>
<header>
    <div class="header">
        <img src="/public/img/u=336605979,1927876303&fm=27&gp=0.jpg" height="100%" width="100%" />
    </div>
</header>
<nav class="nav-title">
    <div class="title">
        {%if category ==''%}
        <a href="/" class="focus">首页</a>
        {%else%}
        <a href="/">首页</a>
        {%endif%}

       {% for cate in categories %}
        {%if category ==cate.id%}
        <a href="/?category={{cate.id}}" class="focus">{{cate.name}}</a>
        {%else%}
        <a href="/?category={{cate.id}}">{{cate.name}}</a>
        {%endif%}
       {%endfor%}
    </div>
</nav>
<div class="content">
    <div class="content-left">

    {%block content%}{%endblock%}

     </div>
    <div class="content-right">

        {%if userInfo._id%}
       <div class="rightBox" id="userInfo"> <!--style="display: none" -->
          <div class="tit"><span>用户信息</span></div>

           <p><span class="cDark">{{userInfo.username}}</span></p>
           {% if userInfo.isAdmin %}
           <p>
               <span class="cDanger">你好，你是管理员</span>
               <a href="/admin">进入管理</a>
           </p>
           {% else %}
           <p><span class="cDanger">你好，欢迎光临我的博客！</span></p>
           {% endif %}


           <p><span class="cDark "><a href="javascript:" id="logout">退出</a></span></p>
       </div>

        {% else %}
        <div class="rightBox" id="loginBox"> <!--style="display: none"-->
            <div class="tit"><span>登录</span></div>
            <div class="line"><span class="cDark">用户名：</span><input name="username" type="text" /><em></em></div>
            <div class="line"><span class="cDark">&nbsp;&nbsp;&nbsp;密码：</span><input name="password" type="password" /><em></em></div>
            <div class="line"><span class="cDark"></span><button>登录</button></div>
            <p class="textRight">没有账号？<a href="javascript:" class="cMint">马上注册</a></p>
            <p class="cWarning textCenter"></p>
        </div>


        <div class="rightBox" id="registerBox"  style="display: none">
            <div class="tit"><span>注册</span></div>
            <div class="line"><span class="cDark">用户名：</span><input type="text" name="username" /><em></em></div>
            <div class="line"><span class="cDark">&nbsp;&nbsp;&nbsp;密码：</span><input name="password" type="password" /><em></em></div>
            <div class="line"><span class="cDark">&nbsp;&nbsp;&nbsp;确认：</span><input name="repassword" type="password" /><em></em></div>
            <div class="line"><span class="cDark"></span><button>注册</button></div>
            <p class="textRight">已有账号？<a href="javascript:" class="cMint">马上登录</a></p>
            <p class="cWarning textCenter"></p>
        </div>
        {% endif %}

    </div>



</div>
</body>
</html>